home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / KEYBOARD.SWG / 0088_Reading F11 & F12.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  4KB  |  87 lines

  1. { > how do I get the f11 and f12 keys? }
  2.  
  3. Program ReadF11F12Keys;
  4. { Written by Andrew Eigus of 2:5100/33@fidonet.org }
  5. { SWAG donation... }
  6.  
  7. const
  8.   F11 = #$85;
  9.   F12 = #$86;
  10.  
  11. Function ReadKey : char; assembler;
  12. Asm
  13.   mov ah,08h
  14.   int 21h
  15. End; { ReadKey }
  16.  
  17. var
  18.   Ch : char;
  19.   Extended : boolean;
  20.  
  21. Begin
  22.   Write('Press F11 or F12 to quit... ');
  23.   repeat
  24.     Ch := ReadKey;
  25.     if Ch = #0 then
  26.     begin
  27.       Extended := True;
  28.       Ch := ReadKey
  29.     end else Extended := False;
  30.   until (Ch in [F11,F12]) and Extended;
  31.   WriteLn('Done.')
  32. End.
  33. {
  34. > ALSO!  What is bit 8 in that address?
  35.  
  36. Two bytes at address 0:0417 and 0:0418 identify the status of the keyboard
  37. shift keys and keyboard toggles.  INT 16H returns the first byte in AL.
  38.  
  39. ╓─7┬─6┬─5┬─4┬─3┬─2┬─1┬─0╖     Perform INT 16H Fn 02H
  40. ║I │C │N │S │a │c │sL│sR║     or fetch AL=byte at 0:0417
  41. ╙─╥┴─╥┴─╥┴─╥┴─╥┴─╥┴─╥┴─╥╜ bit
  42.   ║  ║  ║  ║  ║  ║  ║  ╚═ 0: alpha-shift (right side) DOWN (AL & 01H)
  43.   ║  ║  ║  ║  ║  ║  ╚════ 1: alpha-shift (left side) DOWN  (AL & 02H)
  44.   ║  ║  ║  ║  ║  ╚═══════ 2: Ctrl-shift (either side) DOWN (AL & 04H)
  45.   ║  ║  ║  ║  ╚══════════ 3: Alt-shift  (either side) DOWN (AL & 08H)
  46.   ║  ║  ║  ╚═════════════ 4: ScrollLock state              (AL & 10H)
  47.   ║  ║  ╚════════════════ 5: NumLock state                 (AL & 20H)
  48.   ║  ╚═══════════════════ 6: CapsLock state                (AL & 40H)
  49.   ╚══════════════════════ 7: Insert state                  (AL & 80H)
  50.  
  51. ╓─7┬─6┬─5┬─4┬─3┬─2┬─1┬─0╖
  52. ║i │c │n │s │  │sy│aL│cL║    fetch AL=byte at 0:0418
  53. ╙─╥┴─╥┴─╥┴─╥┴─╥┴─╥┴─╥┴─╥╜ bit
  54.   ║  ║  ║  ║  ║  ║  ║  ╚═ 0: Ctrl-shift (left side) DOWN (AL & 01H)
  55.   ║  ║  ║  ║  ║  ║  ╚════ 1: Alt-shift (left side) DOWN  (AL & 02H)
  56.   ║  ║  ║  ║  ║  ╚═══════ 2: SysReq DOWN                 (AL & 04H)
  57.   ║  ║  ║  ║  ╚══════════ 3: hold/pause state            (AL & 08H)
  58.   ║  ║  ║  ╚═════════════ 4: ScrollLock DOWN             (AL & 10H)
  59.   ║  ║  ╚════════════════ 5: NumLock DOWN                (AL & 20H)
  60.   ║  ╚═══════════════════ 6: CapsLock DOWN               (AL & 40H)
  61.   ╚══════════════════════ 7: Insert DOWN                 (AL & 80H)
  62.  
  63. Notes: Bits 0-2 of 0:0418 are defined only for the 101-key enhanced keyboard.
  64.  
  65.        The 101-key BIOS INT 16H Fn 12H returns AL as with Fn 02, but AH is
  66.        returned with the following bit-flag layout:
  67.  
  68.        ╓─7┬─6┬─5┬─4┬─3┬─2┬─1┬─0╖
  69.        ║sy│c │n │s │aR│cR│aL│cL║    Perform INT 16H Fn 12H (101-key BIOS only)
  70.        ╙─╥┴─╥┴─╥┴─╥┴─╥┴─╥┴─╥┴─╥╜ bit
  71.          ║  ║  ║  ║  ║  ║  ║  ╚═ 0: Ctrl-shift (left side) DOWN  (AH & 01H)
  72.          ║  ║  ║  ║  ║  ║  ╚════ 1: Alt-shift (left side) DOWN   (AH & 02H)
  73.          ║  ║  ║  ║  ║  ╚═══════ 2: Ctrl-shift (right side) DOWN (AH & 04H)
  74.          ║  ║  ║  ║  ╚══════════ 3: Alt-shift (right side) DOWN  (AH & 08H)
  75.          ║  ║  ║  ╚═════════════ 4: ScrollLock DOWN              (AH & 10H)
  76.          ║  ║  ╚════════════════ 5: NumLock DOWN                 (AH & 20H)
  77.          ║  ╚═══════════════════ 6: CapsLock DOWN                (AH & 40H)
  78.          ╚══════════════════════ 7: SysReq DOWN                  (AH & 80H)
  79.  
  80.        Some older programs change the values of NumLock and CapsLock state
  81.        bits (at 0:0417) to force a known status.  This is unwise because
  82.        modern keyboards have indicator lights which will get out of sync with
  83.        the status. See AT Keyboard for more information on the lock-key LEDs.
  84.  
  85.        PCjr status bytes at 0:0488 are omitted for lack of interest [mine─DR].
  86. }
  87.